﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace objass
{
    internal class ClipboardHelper
    {
        public static void SetText(string text)
        {
            int maxRetries = 5;
            int retryDelay = 100; // milliseconds

            for (int i = 0; i < maxRetries; i++)
            {
                try
                {
                    Clipboard.SetText(text);
                    break; // Successfully set, exit the loop
                }
                catch (System.Runtime.InteropServices.COMException)
                {
                    if (i == maxRetries - 1)
                    {
                        throw; // Re-throw the exception if all retries fail
                    }
                    Thread.Sleep(retryDelay); // Wait and retry
                }
            }
            var debug = 1;
        }
    }
}
